package thread;

public class Demo19 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 3; i++) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("线程结束");
        });
        //启动线程
        t.start();
        //等待t线程运行完毕主线程才开始运行
        t.join();
        System.out.println(t.isAlive());
    }
}
